<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        var username = "aaa\\.";
        var reg_username = /^\w{3}\\\.$/;
        alert(reg_username.test(username));
    </script>
</head>
<body>

</body>
</html>